package com.cool4j.generator.util;

import java.sql.Types;

/**
 * 数据库操作工具类
 *
 * @author Frank create on 16/1/8 17:18
 */
public final class DBUtil {

    public static String getColumnType(int databaseType) {
        String columnType = "";

        switch (databaseType) {
            case Types.FLOAT:
            case Types.REAL:
                columnType = "Float";
                break;
            case Types.DOUBLE:
            case Types.DECIMAL:
                columnType = "Double";
                break;
            case Types.INTEGER:
            case Types.BIGINT:
            case Types.SMALLINT:
            case Types.TINYINT:
                columnType = "Integer";
                break;
            case Types.VARCHAR:
            case Types.NVARCHAR:
            case Types.LONGVARCHAR:
            case Types.LONGNVARCHAR:
            case Types.LONGVARBINARY:
            case Types.CHAR:
            case Types.NCHAR:
                columnType = "String";
                break;
            case Types.DATE:
            case Types.TIME:
            case Types.TIMESTAMP:
                columnType = "Date";
                break;
            default:
                System.out.println("找不到数据类型:" + databaseType);
                break;
        }

        return columnType;
    }

}
